<script type="text/javascript" src="/js/clip/ZeroClipboard.js"></script> 
<link href="/admins/css/adminshare.css" rel="stylesheet" type="text/css" />
<link href="/admins/css/yundan.css" rel="stylesheet" type="text/css" />
<link type="text/css" href="/admins/js/jquery/css/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" />
<script type="text/javascript" src="/admins/js/jquery/jquery-ui-1.8.20.custom.min.js"></script>
<script type="text/javascript" src="/admins/js/jquery/jquery.ui.datepicker-zh-CN.js"></script>
<link href="/js/boxy/css/boxy.css" media="screen" rel="stylesheet" type="text/css" >  
<script type="text/javascript">
    $(function(){
        $.datepicker.setDefaults( $.datepicker.regional[ "zh-CN" ] );
        $( ".admin_nrtop #starttime" ).datepicker({
            changeMonth: true,
            changeYear: true
        });
        $( ".admin_nrtop #endtime" ).datepicker({
            changeMonth: true,
            changeYear: true
        });
    });
</script>
<div class="admin_nrtop" style="margin-bottom: 10px;">
    <div class="ad_search">
        <form action=""  method="get" style="margin:0px" id="form1">
            <div class="soubox" style="z-index: 0;">
                <div class="timezhi"><span>时间：</span></div>
                <input type="text" id="starttime" name="starttime" value="<?php echo $this->starttime ? $this->starttime : date("Y-m-d",strtotime("-1 month")); ?>" style="width: 100px;border: 1px solid #ccc;" readonly />
                <div class="timezhi"><span>至</span></div>
                <input type="text" id="endtime" name="endtime" value="<?php echo $this->endtime ? $this->endtime : date("Y-m-d",strtotime("-1 month")); ?>" style="width: 100px;border: 1px solid #ccc;" readonly/>
                <input type="hidden" id="cityId" name="cityId" value="<?php echo $this->cityId ? $this->cityId : 0;?>" />
            </div>
            <div class="timebox">
                <div class="timezdy taobaonameElder" style="width: 90px;margin-left: 20px;">
                    <div class="lixiala" style="line-height: 30px;border: 1px solid #ccc;">
                        <span><?php echo $this->cityId?$this->cityName:"国家";?></span>
                        <i style="top: 15px;"></i>
                    </div>
                    <div class="guojiaceng" style="display:none;top: 30px;">
                        <div class="remen">
                                <h2>热门国家和地区</h2>
                            <ul class="countrylist">
                                <li><a href="javascript:void(0)" id="c_us" cid="0">全部</a></li>
                                <li><a href="javascript:void(0)" cid="1">美国</a></li>
                                <li><a href="javascript:void(0)" cid="2">加拿大</a></li>
                                <li><a href="javascript:void(0)" cid="3">澳大利亚</a></li>
                                <li><a href="javascript:void(0)" cid="47">日本</a></li>
                                <li><a href="javascript:void(0)" cid="39">台湾</a></li>
                                <li><a href="javascript:void(0)" cid="4">新西兰</a></li>
                                <li><a href="javascript:void(0)" cid="5">英国</a></li>
                                <li><a href="javascript:void(0)" cid="42">马来西亚</a></li>
                            </ul>
                        </div>
                        <div class="allcountry">
                            <h2>全部国家和地区</h2>
                            <ul class="countryzm">
                                <?php foreach ($this->words as $char){ ?>
                                    <li <?= $char=='A'?'class="zmon"':'' ?>><a href="javascript:void(0)"><?= $char ?></a></li>
                                <?php } ?>
                            </ul>
                            <div id="countryTab">
                                <?php foreach ($this->words as $char){ ?>
                                <ul class="countrylist"  <?= $char=='A'?'':'style="display:none"' ?>>
                                   <?php $citys= Application_Model_city::GetBySortCode($char);
                                        foreach ($citys as $city){
                                   ?>
                                    <li><a href="javascript:void(0)" cid="<?=$city->Id ?>"><?= $city->Name ?></a></li>
                                    <?php } ?>
                                </ul>
                                <?php } ?>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="timeok">
                    <a href="javascript:$('#form1').submit();">确定</a>
                </div>
            </div>
        </form>
    </div>
</div>
<style>
    .biaoge td{width: 10%;}
    .biaoge .righttd{text-align: right;padding-right: 10px;}
    .table2{padding-top: 10px;}
    .dataComment{margin: 0px 0px 8px -10px;font-size: 20px;}
</style>
<div class="biaoge">
    <input type="hidden" id="iswayData" name="iswayData" value="0" />
    <input type="hidden" id="isorderData" name="isorderData" value="0" />
    <input type="hidden" id="isstoreData" name="isstoreData" value="0" />
    <input type="hidden" id="isuserData" name="isuserData" value="0" />
    <div class="table2" style="padding-top:5px;">
        <div class="dataComment">国际运单数据：
            <?php if(!$this->cityId){?>
                <a href="javascript:void(0)" class="indexa showorhide" name="way">展示/隐藏-详情</a> 
            <?php } ?>
                <a href="javascript:void(0)" class="indexa analysisData" name="way" style="margin-left: 20px;">重新解析数据</a>
        </div>
        <div class="tablebox">
            <table>
                <tr class="trhui">
                    <td class="righttd">客户发单总人数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_WayUser, $this->cityId?$this->cityId:"all");?>人</td>
                    <td class="righttd">国际运单总个数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_WayNum, $this->cityId?$this->cityId:"all");?>个</td>
                    <td class="righttd">国际运单总预付款：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_WayMoney, $this->cityId?$this->cityId:"all");?>元</td>
                    <td class="righttd">国际运单总预付重量：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_WayWeight, $this->cityId?$this->cityId:"all")/1000;?>kg</td>
                    <td class="righttd">国际运单总预付体积：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_WayVolume, $this->cityId?$this->cityId:"all")/1000;?>kg</td>
                </tr>
                <tr class="trhui">
                    <td class="righttd">新客户发单总人数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_WayNewUser, $this->cityId?$this->cityId:"all");?>人</td>
                    <td class="righttd">新客户发单总个数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_WayNewNum, $this->cityId?$this->cityId:"all");?>个</td>
                    <td class="righttd">新客户发单总预付款：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_WayNewMoney, $this->cityId?$this->cityId:"all");?>元</td>
                    <td class="righttd">新客户发单总预付重量：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_WayNewWeight, $this->cityId?$this->cityId:"all")/1000;?>kg</td>
                    <td class="righttd">新客户发单总预付体积：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_WayNewVolume, $this->cityId?$this->cityId:"all")/1000;?>kg</td>
                </tr>
                <tr class="trhui">
                    <td class="righttd">老客户发单总人数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_WayOldUser, $this->cityId?$this->cityId:"all");?>人</td>
                    <td class="righttd">老客户发单总个数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_WayOldNum, $this->cityId?$this->cityId:"all");?>个</td>
                    <td class="righttd">老客户发单总预付款：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_WayOldMoney, $this->cityId?$this->cityId:"all");?>元</td>
                    <td class="righttd">老客户发单总预付重量：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_WayOldWeight, $this->cityId?$this->cityId:"all")/1000;?>kg</td>
                    <td class="righttd">老客户发单总预付体积：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_WayOldVolume, $this->cityId?$this->cityId:"all")/1000;?>kg</td>
                </tr>
            </table>
        </div>
        <div class="wayData" style="display:none;"></div>
    </div>
    <div class="table2">
        <div class="dataComment">代购订单数据：
            <?php if(!$this->cityId){?>
                <a href="javascript:void(0)" class="indexa showorhide" name="order">展示/隐藏-详情</a> 
            <?php } ?>
                <a href="javascript:void(0)" class="indexa analysisData" name="order" style="margin-left: 20px;">重新解析数据</a>
        </div>
        <div class="tablebox">
            <table>
                <tr class="trhui">
                    <td class="righttd">代购订单总人数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_OrderUser, $this->cityId?$this->cityId:"all");?>人</td>
                    <td class="righttd">代购订单总个数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_OrderNum, $this->cityId?$this->cityId:"all");?>个</td>
                    <td class="righttd">代购订单总金额：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_OrderSum, $this->cityId?$this->cityId:"all");?>元</td>
                </tr>
                <tr class="trhui">
                    <td class="righttd">新客户代购总人数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_OrderNewUser, $this->cityId?$this->cityId:"all");?>人</td>
                    <td class="righttd">新客户代购总个数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_OrderNewNum, $this->cityId?$this->cityId:"all");?>个</td>
                    <td class="righttd">新客户代购总金额：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_OrderNewSum, $this->cityId?$this->cityId:"all");?>元</td>
                </tr>
                <tr class="trhui">
                    <td class="righttd">老客户代购总人数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_OrderOldUser, $this->cityId?$this->cityId:"all");?>人</td>
                    <td class="righttd">老客户代购总个数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_OrderOldNum, $this->cityId?$this->cityId:"all");?>个</td>
                    <td class="righttd">老客户代购总金额：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_OrderOldSum, $this->cityId?$this->cityId:"all");?>元</td>
                </tr>
            </table>
        </div>
        <div class="orderData" style="display:none;"></div>
    </div>
    <div class="table2">
        <div class="dataComment">仓库入库数据：
            <?php if(!$this->cityId){?>
                <a href="javascript:void(0)" class="indexa showorhide" name="store">展示/隐藏-详情</a> 
            <?php } ?>
                <a href="javascript:void(0)" class="indexa analysisData" name="store" style="margin-left: 20px;">重新解析数据</a>
        </div>
        <div class="tablebox">
            <table>
                <tr class="trhui">
                    <td class="righttd">客户入库总人数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_StoreUser, $this->cityId?$this->cityId:"all");?>人</td>
                    <td class="righttd">入库总个数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_StoreNum, $this->cityId?$this->cityId:"all");?>个</td>
                    <td class="righttd">入库总重量：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_StoreWeight, $this->cityId?$this->cityId:"all")/1000;?>kg</td>
                </tr>
                <tr class="trhui">
                    <td class="righttd">新客户入库总人数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_StoreNewUser, $this->cityId?$this->cityId:"all");?>人</td>
                    <td class="righttd">新客户入库总个数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_StoreNewNum, $this->cityId?$this->cityId:"all");?>个</td>
                    <td class="righttd">新客户入库总重量：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_StoreNewWeight, $this->cityId?$this->cityId:"all")/1000;?>kg</td>
                </tr>
                <tr class="trhui">
                    <td class="righttd">老客户入库总人数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_StoreOldUser, $this->cityId?$this->cityId:"all");?>人</td>
                    <td class="righttd">老客户入库总个数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_StoreOldNum, $this->cityId?$this->cityId:"all");?>个</td>
                    <td class="righttd">老客户入库总重量：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_StoreOldWeight, $this->cityId?$this->cityId:"all")/1000;?>kg</td>
                </tr>
            </table>
        </div>
        <div class="storeData" style="display:none;"></div>
    </div>
    <div class="table2">
        <div class="dataComment">注册用户数据：
            <?php if(!$this->cityId){?>
                <a href="javascript:void(0)" class="indexa showorhide" name="user">展示/隐藏-详情</a> 
            <?php } ?>
                <a href="javascript:void(0)" class="indexa analysisData" name="user" style="margin-left: 20px;">重新解析数据</a>
        </div>
        <div class="tablebox">
            <table>
                <tr class="trhui">
                    <td class="righttd">注册总人数：</td>
                    <td class="lefttd">
                        <?php echo $this->showData->getSumData($this->starttime, $this->endtime,  Application_Model_DataType::Type_UserNum, $this->cityId?$this->cityId:"all");?>人</td>
                    <td class="righttd">当前会员总数：</td>
                    <td class="lefttd">
                        <?php echo $this->memberCount;?>人</td>
                    <td class="righttd">当前库存重量：</td>
                    <td class="lefttd">
                        <?php echo $this->storeWeight;?>kg</td>
                </tr>
            </table>
        </div>
        <div class="userData" style="display:none;"></div>
    </div>
</div>
<div style="height:140px;">&nbsp;</div>
<script>
$(function(){
    $(".lixiala").click(function(){
        $(".lixiala").attr("class","lixiala");
        $(".lixiala").next("div").hide();
        $(this).attr("class","lixiala bton");
        $(this).next("div").show();
    });
    $(document).bind("click",function(e){
        var target  = $(e.target);
        if(target.closest(".timezdy").length == 0){
            $(".lixiala").attr("class","lixiala");
            $(".lixiala").next("div").attr("style","display:none;");
        }
        if(target.closest("#stime").length == 0){
            $("#stime").attr("class","timeselect");
        }
        if(target.closest("#etime").length == 0){
            $("#etime").attr("class","timeselect");
        }
   });
    $('.countryzm a').each(function(index,item){
        $(item).click(function(){
            $('.countryzm li.zmon').removeClass('zmon');
            $(this).parent().addClass('zmon');
            $('#countryTab ul').hide();
            $('#countryTab ul').eq(index).show();
            return false;
        });
    });
     $('.countrylist a').bind('click',function(){
         $(".soubox #cityId").val($(this).attr('cid'));
         $('#form1').submit();
     });
     $(".showorhide").click(function(){
        var type = $(this).attr("name");
        var isPost = $(".biaoge #is"+type+"Data").val();
        if(!$("."+type+"Data").is(":hidden")){
            $("."+type+"Data").hide();
            return false;
        }
        if(isPost == 1){
            $("."+type+"Data").show();
            return false;
        }
        var starttime = $(".soubox #starttime").val();
        var endtime = $(".soubox #endtime").val();
        $.post("/admini/managereport/showdata",{"type":type,"starttime":starttime,"endtime":endtime},function(html){
            $("."+type+"Data").html(html);
            $("."+type+"Data").show();
            $(".biaoge #is"+type+"Data").val("1");
        });
     });
     $(".analysisData").click(function(){
        var type = $(this).attr("name");
        var starttime = $(".soubox #starttime").val();
        var endtime = $(".soubox #endtime").val();
        $.post("/admini/managetaobao/"+type+"data",{"start":starttime,"end":endtime},function(html){
            html = html.replace(/<[^>].*?>/g,"");
            alert(html);
//            location.reload();
        });
     });
 });
</script>
